//
//  ExScreenRecorderManager.h
//  OC-Example
//
//  Created by lcj on 2020/11/4.
//  Copyright © 2020 apang.men. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <ReplayKit/ReplayKit.h>
NS_ASSUME_NONNULL_BEGIN

API_AVAILABLE(ios(9.0))
@interface ExScreenRecorderConfiguration : NSObject
// defaults is false
@property (nonatomic, assign) BOOL isLandscape;
// defaults is false
@property (nonatomic, assign) BOOL microphoneEnabled;
// save file name eg: 11111
@property (nonatomic, copy, nonnull) NSString * fileName API_AVAILABLE(ios(11.0));
// defaults 30
@property (nonatomic, assign) NSInteger frameRate API_AVAILABLE(ios(11.0));
@end

API_AVAILABLE(ios(9.0))
@interface ExScreenRecorderManager : NSObject

+ (ExScreenRecorderManager *)sharedInstance;
+ (BOOL)isRecording;
+ (void)startRecordingWithConfiguration:(nonnull ExScreenRecorderConfiguration *)configuration handler:(nullable void(^)(NSError * _Nullable error))handler;
- (BOOL)addAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer;
+ (void)stopRecordingWithHandler:(nullable void(^)(RPPreviewViewController * _Nullable previewViewController, NSString * _Nullable filePath , NSError * _Nullable error))handler;
@end

NS_ASSUME_NONNULL_END
